using Microsoft.Xna.Framework.Input.Touch;
using Rocuna.GameEngine.Extension.WP7.Input.Constants;
using Rocuna.GameEngine.Graphics.Cameras;
using Rocuna.GameEngine.Input;

namespace Rocuna.GameEngine.Extension.WP7.Extensions
{
    /// <summary>
    /// Extension methods for all camera types.
    /// </summary>
    public static class CameraExtension
    {
        /// <summary>
        /// Registers the default behvior.
        /// </summary>
        /// <param name="self">The self.</param>
        public static void RegisterDefaultBehvior(this ArcBallCamera self)
        {
            var inputManager = self.Game.GetService<InputManager>();
            inputManager.RegisterActionToDevice(
                PhoneDevices.PhoneGestureDevice, GestureType.HorizontalDrag,
                o =>
                {
                    var data = (GestureSample)o;
                    self.Rotate(data.Delta.X * 0.001f, data.Delta.Y * 0.001f);
                });
            inputManager.RegisterActionToDevice(
                PhoneDevices.PhoneGestureDevice, GestureType.Pinch,
                o =>
                {
                    var data = (GestureSample)o;
                    //ToDo - Handle zooming - can't test without Physic Device
                });
        }
    }
}